When applied to computer languages, stropping refers to the method used to mark letter sequences as having a special property such as being a keyword or certain type of variable or storage location.
The use of stropping allows the same letter sequence to be used both as a keyword and as an identifier, and more efficient lexical pre-pass before parsing, virtually eliminating the need for a complex lexer such as Lex.
Contents |
A range of different syntaxes for stropping have been used:
'BEGIN'
or ‘BEGIN’
).'BEGIN
)[3]In fact it was often the case that several stropping conventions might be in use within the one language:
underlined
using backspace and overstrike on a Flexowriter keyboard, they could be introduced by a %percent %symbol
, or they could be typed in UPPER CASE
with no delimiting character (in which case all variables had to be in lower case).Algol68 as typically published
¢ bold or underline typeface ¢ mode xint = int; xint sum sq:=0; for i while sum sq≠70×70 do sum sq+:=i↑2 od |
Quote stropping (like wikitext)
'pr' quote 'pr' 'mode' 'xint' = 'int'; 'xint' sum sq:=0; 'for' i 'while' sum sq≠70×70 'do' sum sq+:=i↑2 'od' |
For a 7-bit character code compiler
.PR UPPER .PR MODE XINT = INT; XINT sum sq:=0; FOR i WHILE sum sq/=70*70 DO sum sq+:=i**2 OD |
For a 6-bit character code compiler
.PR POINT .PR .MODE .XINT = .INT; .XINT SUM SQ:=0; .FOR I .WHILE SUM SQ .NE 70*70 .DO SUM SQ .PLUSAB I .UP 2 .OD |
Algol68 using res stropping (reserved word)
.PR RES .PR mode .xint = int; .xint sum sq:=0; for i while sum sq≠70×70 do sum sq+:=i↑2 od |
Most modern programming languages do not use stropping - although Ruby and Perl both use sigils to identify characteristics of variables/constants: Perl to designate the type of variable, Ruby to distinguish variables from constants and to indicate scope.